package com.evildog.workspace.file.convert;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.evildog.workspace.common.result.PagedResult;
import com.evildog.workspace.file.bo.DocBO;
import com.evildog.workspace.file.bo.DocPageBO;
import com.evildog.workspace.file.dto.DocDTO;
import com.evildog.workspace.file.dto.DocPageDTO;
import com.evildog.workspace.file.entity.Doc;
import com.evildog.workspace.file.entity.DocPageDO;
import com.evildog.workspace.file.model.DocPageParam;
import com.evildog.workspace.file.model.DocParam;
import com.evildog.workspace.file.upload.object.VirtualFileDTO;
import com.evildog.workspace.file.vo.DocPageVO;
import com.evildog.workspace.file.vo.DocVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface DocConvert {

    DocConvert INSTANCE = Mappers.getMapper(DocConvert.class);

    DocPageDTO convert(DocPageParam docPageParam);

    DocDTO convert(DocParam docParam);

    @Mapping(target = "isDeleted", ignore = true)
    Doc convert(DocDTO docDTO);

    DocPageDO convert(DocPageDTO docPageDTO);

    DocVO convert(DocBO docBO);

    DocBO convert(Doc doc);

    List<DocBO> convert(List<Doc> docList);

    @Mappings({})
    PagedResult<DocPageBO> convert(IPage<DocPageDO> page);

    PagedResult<DocPageVO> convert(PagedResult<DocPageBO> page);

    @Mapping(target = "name", source = "filename")
    Doc convert(VirtualFileDTO virtualFileDTO);
}